#include "StdAfx.h"
#include "File.h"


CFile::CFile()
{
}

CFile::~CFile()
{
}

CFile *CFile::open(char *name)
{
	CFile *file = new CFile();
	
	FS_InitFile(&file->m_file);
	
	if (!FS_OpenFile(&file->m_file, name))
	{
		delete file;
		return NULL;
	}

	file->m_size = FS_GetLength(&file->m_file);	

	return file;
}

void CFile::close(CFile *&file)
{
	FS_CloseFile(&file->m_file);
	delete file;
	file = NULL;
}

int CFile::read(void *buf, u32 count)
{
	return FS_ReadFile(&m_file, buf, count);
}

BOOL CFile::seek(int pos)
{
	return FS_SeekFile(&m_file, pos, FS_SEEK_SET);
}
